package br.project.cdd.presentation;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import br.project.cdd.bean.CddBean;
import br.project.cdd.vo.CddVO;

public class CddServlet extends HttpServlet {
		
	@Override
	public void service(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException {
		
		CddVO cddVo = new CddVO();
		CddBean cdd = new CddBean();
		
		cdd.setNome_cdd(request.getParameter("txtNome"));
		cdd.setLocalidade(request.getParameter("txtLocalidade"));
		cdd.setUf(request.getParameter("ddlUf"));
		cdd.setNum_cdd(request.getParameter("txtNumCdd"));
		
		cddVo.inserirCdds(cdd);
		
		response.sendRedirect("index.jsp");
	}
}
